public class BattleAssoc {
	public int clockstep;
	protected Rally rallyA;
	protected Rally rallyB;

	public BattleAssoc(Rally _rallyA, Rally _rallyB) {
		this.rallyA = _rallyA;
		this.rallyB = _rallyB;
		this.clockstep = 0;
	}

	public void Battle() {
		this.clockstep++;
		if (((rallyA.getDir() + rallyB.getDir()) >= 9)
				&& ((rallyA.getDir() + rallyB.getDir()) <= 10)) {
			if ((50 + this.clockstep % 50) == 50) {
				if (rallyB.mode == "ATTACK")
					rallyA.setHealth(rallyB.getStatus()[2]);
				else if (rallyB.mode == "DEFEND")
					rallyA.setHealth(rallyB.getStatus()[3]);
			} else if (50 + this.clockstep % 50 == 100) {
				if (rallyA.mode == "ATTACK")
					rallyB.setHealth(rallyA.getStatus()[2]);
				else if (rallyA.mode == "DEFEND")
					rallyB.setHealth(rallyA.getStatus()[3]);
			}
		}
		if (this.clockstep == 101)
			this.clockstep = 1;
	}
}
